package com.fileCenter.util;

import java.io.File;

public class FileUploadProperties {
	public static String UPLOAD_TEMP_DIR = "C:/upload_temp";
	public static int FILE_REPLICATION = 2;
	public static String[] UPLOAD_FILE_DIRS = {"C:/upload1", "C:/upload2"};
	public static long MAX_UPLOAD_FILE_SIZE = 10485760;
	
	
	static {
		checkFile(UPLOAD_TEMP_DIR);
		for (String updateFile : UPLOAD_FILE_DIRS) {
			checkFile(updateFile);
		}
	}
	
	private static File checkFile(String filePath) {
		File file = new File(filePath);
		
		if (!file.exists()) {
			checkFile(file.getParent());
			file.mkdir();
		}
		return file;
	}
}
